function showA(a:string,b:boolean){
    console.log(a,b);
}
// showA(1,"asda");
showA("asda",true);

//非严格模式下，形参不定义变量类型，默认为any
// function showB(a,b,c){
//     console.log(a,b,c);
// }
// showB(1,"qweq",true);

function ShowC(a:string,b?:number,c?:number){
    console.log(a,b);
}

ShowC("123",123);
ShowC("123",123,1231);

//默认参数
function showD(a:number,b:string="asd"){

}

//不能确定传实参的时候第二位到底传还是没传 会报错
// function showE(a:string,b?:number = 123,c?:string){

// }
// showE("asda")

function showE(arg:any = "默认值"){
    console.log(arg);
}

function showF(arg:any){
    arg = arg || "默认值"
}


function get(url:string,data?:any,callback?:any,type?:any){
    if(typeof data === "function"){
        type = callback;
        callback = data;
        data = undefined;
    }
}


function showG(){
    return "asda"
}

function showH():void {
    console.log(1);
    // return as;
    return;
    console.log(2);
}

function showI():string{
    throw new Error("错误");
}

function showJ(params:boolean):string{
    if(params){
        return "真";
    }else{
        return "假";
    }
}

showJ(true);

function showK(params:string):string{
    try{
        return JSON.parse(params);
    }catch(error){
        throw error;
    }

}


